3.685 \(\int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^3} \, dx\)

Optimal. Leaf size=93 \[ -\frac {a^2 (3 B+i A)}{2 c^3 f (\tan (e+f x)+i)^2}-\frac {2 a^2 (A-i B)}{3 c^3 f (\tan (e+f x)+i)^3}-\frac {i a^2 B}{c^3 f (\tan (e+f x)+i)} \]

[Out]

-2/3*a^2*(A-I*B)/c^3/f/(tan(f*x+e)+I)^3-1/2*a^2*(I*A+3*B)/c^3/f/(tan(f*x+e)+I)^2-I*a^2*B/c^3/f/(tan(f*x+e)+I)

________________________________________________________________________________________

Rubi [A]  time = 0.15, antiderivative size = 93, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 41, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.049, Rules used = {3588, 77} \[ -\frac {a^2 (3 B+i A)}{2 c^3 f (\tan (e+f x)+i)^2}-\frac {2 a^2 (A-i B)}{3 c^3 f (\tan (e+f x)+i)^3}-\frac {i a^2 B}{c^3 f (\tan (e+f x)+i)} \]

Antiderivative was successfully verified.

[In]

Int[((a + I*a*Tan[e + f*x])^2*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x])^3,x]

[Out]

(-2*a^2*(A - I*B))/(3*c^3*f*(I + Tan[e + f*x])^3) - (a^2*(I*A + 3*B))/(2*c^3*f*(I + Tan[e + f*x])^2) - (I*a^2*
B)/(c^3*f*(I + Tan[e + f*x]))

Rule 77

Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegran
d[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && ((ILtQ[
n, 0] && ILtQ[p, 0]) || EqQ[p, 1] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1
, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))

Rule 3588

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[(a*c)/f, Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^3} \, dx &=\frac {(a c) \operatorname {Subst}\left (\int \frac {(a+i a x) (A+B x)}{(c-i c x)^4} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {(a c) \operatorname {Subst}\left (\int \left (\frac {2 a (A-i B)}{c^4 (i+x)^4}+\frac {a (i A+3 B)}{c^4 (i+x)^3}+\frac {i a B}{c^4 (i+x)^2}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {2 a^2 (A-i B)}{3 c^3 f (i+\tan (e+f x))^3}-\frac {a^2 (i A+3 B)}{2 c^3 f (i+\tan (e+f x))^2}-\frac {i a^2 B}{c^3 f (i+\tan (e+f x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 2.99, size = 81, normalized size = 0.87 \[ \frac {a^2 (\cos (5 e+7 f x)+i \sin (5 e+7 f x)) ((B-5 i A) \cos (e+f x)-(A+5 i B) \sin (e+f x))}{24 c^3 f (\cos (f x)+i \sin (f x))^2} \]

Antiderivative was successfully verified.

[In]

Integrate[((a + I*a*Tan[e + f*x])^2*(A + B*Tan[e + f*x]))/(c - I*c*Tan[e + f*x])^3,x]

[Out]

(a^2*(((-5*I)*A + B)*Cos[e + f*x] - (A + (5*I)*B)*Sin[e + f*x])*(Cos[5*e + 7*f*x] + I*Sin[5*e + 7*f*x]))/(24*c
^3*f*(Cos[f*x] + I*Sin[f*x])^2)

________________________________________________________________________________________

fricas [A]  time = 0.58, size = 49, normalized size = 0.53 \[ \frac {{\left (-2 i \, A - 2 \, B\right )} a^{2} e^{\left (6 i \, f x + 6 i \, e\right )} + {\left (-3 i \, A + 3 \, B\right )} a^{2} e^{\left (4 i \, f x + 4 i \, e\right )}}{24 \, c^{3} f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^3,x, algorithm="fricas")

[Out]

1/24*((-2*I*A - 2*B)*a^2*e^(6*I*f*x + 6*I*e) + (-3*I*A + 3*B)*a^2*e^(4*I*f*x + 4*I*e))/(c^3*f)

________________________________________________________________________________________

giac [B]  time = 2.79, size = 165, normalized size = 1.77 \[ -\frac {2 \, {\left (3 \, A a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} + 3 i \, A a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} - 3 \, B a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} - 8 \, A a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + 2 i \, B a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 3 i \, A a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 3 \, B a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 3 \, A a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{3 \, c^{3} f {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}^{6}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^3,x, algorithm="giac")

[Out]

-2/3*(3*A*a^2*tan(1/2*f*x + 1/2*e)^5 + 3*I*A*a^2*tan(1/2*f*x + 1/2*e)^4 - 3*B*a^2*tan(1/2*f*x + 1/2*e)^4 - 8*A
*a^2*tan(1/2*f*x + 1/2*e)^3 + 2*I*B*a^2*tan(1/2*f*x + 1/2*e)^3 - 3*I*A*a^2*tan(1/2*f*x + 1/2*e)^2 + 3*B*a^2*ta
n(1/2*f*x + 1/2*e)^2 + 3*A*a^2*tan(1/2*f*x + 1/2*e))/(c^3*f*(tan(1/2*f*x + 1/2*e) + I)^6)

________________________________________________________________________________________

maple [A]  time = 0.24, size = 69, normalized size = 0.74 \[ \frac {a^{2} \left (-\frac {i B}{\tan \left (f x +e \right )+i}-\frac {i A +3 B}{2 \left (\tan \left (f x +e \right )+i\right )^{2}}-\frac {-2 i B +2 A}{3 \left (\tan \left (f x +e \right )+i\right )^{3}}\right )}{f \,c^{3}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^3,x)

[Out]

1/f*a^2/c^3*(-I*B/(tan(f*x+e)+I)-1/2*(I*A+3*B)/(tan(f*x+e)+I)^2-1/3*(2*A-2*I*B)/(tan(f*x+e)+I)^3)

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))^3,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

mupad [B]  time = 8.69, size = 87, normalized size = 0.94 \[ \frac {\frac {a^2\,\left (A-B\,1{}\mathrm {i}\right )}{6}+\frac {a^2\,\mathrm {tan}\left (e+f\,x\right )\,\left (-3\,B+A\,3{}\mathrm {i}\right )}{6}+B\,a^2\,{\mathrm {tan}\left (e+f\,x\right )}^2\,1{}\mathrm {i}}{c^3\,f\,\left (-{\mathrm {tan}\left (e+f\,x\right )}^3-{\mathrm {tan}\left (e+f\,x\right )}^2\,3{}\mathrm {i}+3\,\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i)^2)/(c - c*tan(e + f*x)*1i)^3,x)

[Out]

((a^2*(A - B*1i))/6 + (a^2*tan(e + f*x)*(A*3i - 3*B))/6 + B*a^2*tan(e + f*x)^2*1i)/(c^3*f*(3*tan(e + f*x) - ta
n(e + f*x)^2*3i - tan(e + f*x)^3 + 1i))

________________________________________________________________________________________

sympy [A]  time = 0.56, size = 168, normalized size = 1.81 \[ \begin {cases} \frac {\left (- 12 i A a^{2} c^{3} f e^{4 i e} + 12 B a^{2} c^{3} f e^{4 i e}\right ) e^{4 i f x} + \left (- 8 i A a^{2} c^{3} f e^{6 i e} - 8 B a^{2} c^{3} f e^{6 i e}\right ) e^{6 i f x}}{96 c^{6} f^{2}} & \text {for}\: 96 c^{6} f^{2} \neq 0 \\\frac {x \left (A a^{2} e^{6 i e} + A a^{2} e^{4 i e} - i B a^{2} e^{6 i e} + i B a^{2} e^{4 i e}\right )}{2 c^{3}} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))**2*(A+B*tan(f*x+e))/(c-I*c*tan(f*x+e))**3,x)

[Out]

Piecewise((((-12*I*A*a**2*c**3*f*exp(4*I*e) + 12*B*a**2*c**3*f*exp(4*I*e))*exp(4*I*f*x) + (-8*I*A*a**2*c**3*f*
exp(6*I*e) - 8*B*a**2*c**3*f*exp(6*I*e))*exp(6*I*f*x))/(96*c**6*f**2), Ne(96*c**6*f**2, 0)), (x*(A*a**2*exp(6*
I*e) + A*a**2*exp(4*I*e) - I*B*a**2*exp(6*I*e) + I*B*a**2*exp(4*I*e))/(2*c**3), True))

________________________________________________________________________________________